home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 142
/
Gekkan Dennou Club - 2000.3 Vol. 142 (Japan).7z
/
Gekkan Dennou Club - 2000.3 Vol. 142 (Japan) (Track 1).bin
/
tools
/
s_tool
/
recode.c
< prev
next >
Wrap
Text File
|
1999-06-04
|
16KB
|
783 lines
#include "JX250.H"
#include <sys\iocs.h>
#include <sys\dos.h>
#include <sys\scsi.h>
#include <stdio.h>
#include <stdlib.h>
//---- 上の群
static UNchar b1[12*12]={
"11ab 22cd "
" "
"33ef 44gh "
" "
"5555 6666 77"
"5555 6666 77"
" "
"AABBCCDDEEFF"
" ZZ "
"GGGGGGGGGGGG"
" "
"ij "
};
int RecX1,RecY1,RecX2,RecY2;
int RecVwBai; // 0;x1 1;x2 2;x4 3;x8
//-1;/2 -2;/4 -3;/8
int RecPX,RecPY;
int RecSavMode; // 0;CUT 1;PIC 2;GLM 3;BMP 4;JPEG 5;RGB
UNchar BaiStr[][8]={"","1/8","1/4","1/2","x1","x2","x4","x8"};
UNchar FileStStr[][8]={
"DIR.",
"NAME",
"TIME", // 0;dir 1;filename 2;日付 3;Size
"SIZE"
};
int ViewFileY;
extern UNchar msp[17];
extern int DataMd;
extern int PreDataMd;
/********************************************************
記録モード
********************************************************/
int RecodeMode()
{
int _PreXV1,_PreYV1,_PreXV2,_PreYV2;
MAP=&MapAdds[32*32];
if ( RecX2==0 || RecY2==0 || RecX2>ScanDataX-1 || RecY2>ScanDataY-1 ){
RecX1=0;
RecY1=0;
RecX2=ScanDataX-1;
RecY2=ScanDataY-1;
}
_PreXV1 = PreXV1;
_PreYV1 = PreYV1;
_PreXV2 = PreXV2;
_PreYV2 = PreYV2;
//----- 画面制作
RecodeModeDraw();
//---- 動く
Rec_move();
//====== 画面を戻す
MAP=MapAdds;
Rec_PosDedraw();
PreXV1 = _PreXV1;
PreYV1 = _PreYV1;
PreXV2 = _PreXV2;
PreYV2 = _PreYV2;
_iocs_crtmod(0x100+12);
ViewScrren();
PreviewView();
return(0);
}
/*********************************
**********************************/
void RecodeModeDraw()
{
int x,y;
int a;
int ssp;
UNchar *M;
struct _fillptr PP;
TXCLS(1);
AspScreen();
_iocs_g_clr_on();
GraphicV(0);
ssp=_iocs_b_super(0);
for(y=0;y<32;y++){
a=TADDS(0,y);
M=&MAP[(y)*32];
for(x=0;x<32;x++,a+=32)
GGSP16_64_S(a,*M++);
}
if ( ssp>=0 )
_iocs_b_super(ssp);
//---- 文字
p_12K(19*16,1*16+3,"原点X");
p_12K(24*16,1*16+3,"原点Y");
p_12K(19*16,3*16+3,"幅");
p_12K(24*16,3*16+3,"高さ");
//---- ロード/セーブ
SwIconWaku(19*2,6*2,4*2,2*2);
p_16K(19*2*8,6*2*8+8," セーブ");
SwIconWaku(24*2,6*2,4*2,2*2);
p_16K(24*2*8,6*2*8+8," ロード");
//---- 画像
p_12_sprintf(11*16+2+6,2,BaiStr[ RecVwBai+4 ]);
//----
Rec_SaveModeDraw();
Rec_SortModeDraw();
//----
if ( FilerAllMode!=0 ){
// 0;関係ファイルのみ表示 1;全ファイル表示
GGREV(VADDS(0,19*16,30*16),32,16);
}
//---- ヂレクトリ
PP.x1=19*16+1;
PP.y1=14*16+1;
PP.x2=30*16-1-1;
PP.y2=30*16-1-1;
PP.color=PalTable[15];
_iocs_fill(&PP);
//---- ファイルチェック
FileSearch(0);
ViewFiles(-1);
ViewFiles(ViewFileY);
//---- 画像表示
MakeGammaTable(DataMd);
ScanGraphView(RecPX,RecPY,0);
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
GraphicV(-1);
}
/**************************************************
**************************************************/
int Rec_move()
{
int i,r,f;
int x,y,xx,yy,xo,yo,b;
for(;;){
_dos_keysns();
_dos_change_pr();
xo=-1;
yo=-1;
do {
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( xo!=xx || yo!=yy ){
f=Rec_fream_mousepos(xx,yy);
MsPat(msp[f+1]);
xo=xx;
yo=yy;
}
if ( _iocs_bitsns(3)&bit(7) ){
AspMode^=1;
AspScreen();
while( _iocs_bitsns(3)&bit(7) );
}
} while( MS_LSW()==0 && (b=MS_RSW())==0 );
if ( b!=0 ){
if ( xx>=2*8-2 && xx<16+256+2 && yy>=2*8-2 && yy<62*8+2 )
Rec_click_bar( xx,yy );
} elif ( f>=0 ){
// 枠内だ
if ( (_iocs_bitsns(0xE)&bit(0))==0 ){
Rec_move_fream(xx,yy,f);
} else {
MsPat(1);
Rec_new_fream(xx,yy);
}
} elif ( xx>=2*8-2 && xx<16+256+2 && yy>=2*8-2 && yy<62*8+2 ){
// 枠スキャン画面内だ
Rec_new_fream(xx,yy);
} else {
x=xx/16;
y=yy/16;
//printf("%2d,%2d:%2d %02X \r",x,y,f);
r=0;
if ( x>=19 && x<31 && y>=2 && y<14 ){
//--- 上のボックス
i=b1[(x-19)+(y-2)*12];
if ( i==' ' )
continue;
//printf("\t\t<%02X>\r",i);
r=Rec_click_botton1( i,xx,yy );
} elif ( (x==13 || x==14) && y==0 ){
//---表示倍率
r=Rec_click_botton4(x);
} elif ( x==0 && ( y==1 || y==30 ) ){
//--- 縦バー(ボタン)
r=Rec_click_botton6(y,0);
} elif ( xx>=6 && xx<=9 && yy>=32 && yy<480 ){
//--- 縦バー
r=Rec_click_botton6(yy,1);
} elif ( y==31 && ( x==1 || x==15 ) ){
//--- 横バーボタン
r=Rec_click_botton7(x,0);
} elif ( yy>=501 && yy<=506 && xx>=32 && xx<15*16 ){
//--- 縦バー
r=Rec_click_botton7(xx,1);
} elif ( x>=19 && x<31 && y>=14 && y<30 ){
if ( x==30 ){
// スクロールボタン
r=Rec_click_roll( y-14 );
} else {
// ファイル群
r=Rec_click_files( y-14 );
}
} elif ( y==30 ){
//-- UNDER BAR
if ( x==19 || x==20 ){
//---ALLor ??
if ( FilerAllMode==0 ){
FilerAllMode=1;
// 書き直して反転
GGSP16_OF(TADDS(19,30),MAP[19+30*32],MAP[20+30*32]);
GGREV(VADDS(0,19*16,30*16),32,16);
FileSearch(0);
ViewFiles(-1);
ViewFiles(ViewFileY);
} else {
// 書き直す
FilerAllMode=0;
GGSP16_OF(TADDS(19,30),MAP[19+30*32],MAP[20+30*32]);
FileSearch(0);
ViewFiles(-1);
ViewFiles(ViewFileY);
}
} else if ( x==24 || x==25 ){
//---Sort内容変更
r=Rec_click_botton1( (x==24)?'x':'y',xx,yy );
} else if ( x==27 || x==28 ){
//---DEL
Rec_PosDedraw();
r=Rec_click_del();
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
}
}
if ( r==99 )
return(0);
}
while( MS_LSW()!=0 || MS_RSW()!=0 ){
_dos_keysns();
_dos_change_pr();
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( xo!=xx || yo!=yy ){
f=Rec_fream_mousepos(xx,yy);
MsPat(msp[f+1]);
xo=xx;
yo=yy;
}
}
}
return(r);
}
/**********************************************************
フレームとマウスの関係
[rtn] -1 ; 違うところ
0 ; 中
bit 0 ; 上 bit 1 ; 左
bit 2 ; 右 bit 3 ; 下
**********************************************************/
int Rec_fream_mousepos(xx,yy)
int xx,yy;
{
int r;
if ( ScanData==0 ) // 「画像」のポインタ
return(-1);
r=0;
//--- 中
if ( xx<PreXV1-2 || xx>PreXV2+2 || yy<PreYV1-2 || yy>PreYV2+2 )
return(-1);
if ( xx<16-2 || xx>256+16+2 || yy<16-2 || yy>496+2 )
return(-1);
//--- 上チェック
if ( yy<PreYV1+6 ) r|=bit(0);
//--- 左チェック
if ( xx<PreXV1+6 ) r|=bit(1);
//--- 下チェック
if ( yy>PreYV2-6 ){
r&=nbit(0);
r|=bit(3);
}
//--- 右チェック
if ( xx>PreXV2-6 ){
r&=nbit(1);
r|=bit(2);
}
return( r );
}
/********************************************************
座標表示
********************************************************/
void Rec_PosSetDraw(x1,y1,x2,y2)
int x1,y1,x2,y2;
{
int i,f;
int ssp;
int vxo1,vyo1,vxo2,vyo2;
if ( ScanData==0 ){ // 「画像」のポインタ
//- 原点
p_12W(32+272+2,32+2," ");
p_12W(32+352+2,32+2," ");
//- 幅,高さ
p_12W(32+272+2,64+2," ");
p_12W(32+352+2,64+2," ");
return;
}
ssp=_iocs_b_super(0);
f=0;
if ( x1>=0 ){
// セット
vxo1=PreXV1;
vyo1=PreYV1;
vxo2=PreXV2;
vyo2=PreYV2;
RecX1=x1; RecY1=y1;
RecX2=x2; RecY2=y2;
if ( RecX1==RecX2 )
RecX2++;
if ( RecY1==RecY2 )
RecY2++;
f=-1;
if ( RecVwBai>=0 ){
i=1<<RecVwBai;
PreXV1 = 16+(RecX1*i)-(RecPX*i);
PreYV1 = 16+(RecY1*i)-(RecPY*i);
PreXV2 = 16+((RecX2)*i)-(RecPX*i)+i-1;
PreYV2 = 16+((RecY2)*i)-(RecPY*i)+i-1;
} else {
i=1<<(-RecVwBai);
PreXV1 = 16+(RecX1/i)-(RecPX/i);
PreYV1 = 16+(RecY1/i)-(RecPY/i);
PreXV2 = 16+(RecX2/i)-(RecPX/i)-1;
PreYV2 = 16+(RecY2/i)-(RecPY/i)-1;
}
}
CRTVDISP_S();
//- 原点
p_12_sprintf(32+272+2,32+2,"%5d",RecX1); //X
p_12_sprintf(32+352+2,32+2,"%5d",RecY1); //Y
//- 幅,高さ
p_12_sprintf(32+272+2,64+2,"%5d",(RecX2-RecX1+1));
p_12_sprintf(32+352+2,64+2,"%5d",(RecY2-RecY1+1));
if ( f!=0 ){
if ( vxo2>0 && vyo2>0 ){
DrawWaku(vxo1,vyo1,vxo2,vyo2,1,0);
} else {
CRTVDISP_S();
}
DrawWaku(PreXV1,PreYV1,PreXV2,PreYV2,1,-1);
}
if ( ssp>=0 )
_iocs_b_super(ssp);
return;
}
/****************************
消し
****************************/
void Rec_PosDedraw()
{
DrawWaku(PreXV1,PreYV1,PreXV2,PreYV2,1,0);
}
/**********************************************************
枠移動
**********************************************************/
void Rec_move_fream(sx,sy,fm)
int sx,sy,fm;
{
int i,x,y,xo,yo,bi,bii;
int xx,yy,b;
int x1o,y1o,x2o,y2o;
int x1,x2,y1,y2;
int _RecX1,_RecY1;
int _RecX2,_RecY2;
int RPX,RPY;
//--- 記憶
_RecX1 = RecX1;
_RecY1 = RecY1;
_RecX2 = RecX2;
_RecY2 = RecY2;
x1o=y1o=-1;
xo=-1;
yo=-1;
if ( RecVwBai>=0 ){
bi=1<<RecVwBai;
RPX=ScanDataX-(256/bi);
RPY=ScanDataY-(480/bi);
bii=32+32/bi;
} else {
bi=1<<(-RecVwBai);
RPX=ScanDataX-(256*bi);
RPY=ScanDataY-(480*bi);
bii=16;
}
while( MS_LSW()!=0 && (b=MS_RSW())==0 ){
_dos_keysns();
_dos_change_pr();
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( xo==xx && yo==yy )
continue;
xo=xx;
yo=yy;
{
int _x,_y;
i=_iocs_ms_getdt();
//x1=(int)(char)((i>>24)&0xFF);;
//y1=(int)(char)((i>>16)&0xFF);;
_x=RecPX;
_y=RecPY;
if ( xx<16 ){
RecPX-=bii;
//RecPX-=-x1;
if ( RecPX<0 )
RecPX=0;
}
if ( yy<16-3 ){
RecPY-=bii;
//RecPY-=-y1;
if ( RecPY<0 )
RecPY=0;
}
if ( xx>256+16 ){
RecPX+=bii;
//RecPX+=x1;
if ( RecPX>=RPX ){
RecPX=RPX-1+1;
if ( RecPX<0 )
RecPX=0;
}
}
if ( yy>496+3 ){
RecPY+=bii;
//RecPY+=y1;
if ( RecPY>=RPY ){
RecPY=RPY-1+1;
if ( RecPY<0 )
RecPY=0;
}
}
if ( _x!=RecPX || _y!=RecPY ){
if ( RecVwBai>=0 ){
sx+=(_x-RecPX)*bi;
sy+=(_y-RecPY)*bi;
xx+=(_x-RecPX)*bi;
yy+=(_y-RecPY)*bi;
} else {
sx+=(_x-RecPX)/bi;
sy+=(_y-RecPY)/bi;
xx+=(_x-RecPX)/bi;
yy+=(_y-RecPY)/bi;
}
Rec_PosDedraw();
ScanGraphView(RecPX,RecPY,0);
//printf("PX=%2d,PY=%2d\r");
Rec_PosSetDraw(RecX1,RecY1,RecX2,RecY2);
_iocs_ms_curst(xx,yy);
}
}
if ( RecVwBai>=0 ){
x=(xx-sx)/bi;
y=(yy-sy)/bi;
} else {
x=(xx-sx)*bi;
y=(yy-sy)*bi;
}
x1 = _RecX1;
y1 = _RecY1;
x2 = _RecX2;
y2 = _RecY2;
if ( fm==0 ){
//--- 全体ムーブ
//
if ( x<0 ){
if ( x1+x>=0 ){
x1 += x;
x2 += x;
} else {
x2 -= x1;
x1 -= x1;
}
} elif ( x>0 ){
if ( x2+x<=ScanDataX-1 ){
x1 += x;
x2 += x;
} else {
x1 += (ScanDataX-1)-x2;
x2 += (ScanDataX-1)-x2;
}
}
if ( y<0 ){
if ( y1+y>=0 ){
y1 += y;
y2 += y;
} else {
y2 -= y1;
y1 -= y1;
}
} elif ( y>0 ){
if ( y2+y<=ScanDataY-1 ){
y1 += y;
y2 += y;
} else {
y1 += (ScanDataY-1)-y2;
y2 += (ScanDataY-1)-y2;
}
}
} else {
// bit 0 ; 上 bit 1 ; 左
// bit 2 ; 右 bit 3 ; 下
if ( (fm&bit(0))!=0 ){
//上
if ( y<0 ){
if ( y1+y>=0 )
y1 += y;
else y1 = 0;
} else {
if ( y1+y<=(y2-16) )
y1 += y;
else y1 = (y2-16);
}
}
if ( (fm&bit(1))!=0 ){
//左
if ( x<0 ){
if ( x1+x>=0 )
x1 += x;
else x1 = 0;
} else {
if ( x1+x<=(x2-16) )
x1 += x;
else x1 = (x2-16);
}
}
if ( (fm&bit(2))!=0 ){
//右
if ( x<0 ){
if ( x2+x>=(x1+16) )
x2 += x;
else x2 = (x1+16);
} else {
if ( x2+x<=ScanDataX-1 )
x2 += x;
else x2 = (ScanDataX-1);
}
}
if ( (fm&bit(3))!=0 ){
//下
if ( y<0 ){
if ( y2+y>=(y1+16) )
y2 += y;
else y2 = (y1+16);
} else {
if ( y2+y<=ScanDataY-1 )
y2 += y;
else y2 = (ScanDataY-1);
}
}
}
if ( x1!=x1o || y1!=y1o || x2!=x2o || y2!=y2o ){
Rec_PosSetDraw(x1,y1,x2,y2);
x1o=x1;
y1o=y1;
x2o=x2;
y2o=y2;
}
}
if ( b!=0 ){
//右クリック キャンセル
Rec_PosSetDraw(_RecX1,_RecY1,_RecX2,_RecY2);
MsPat(-1);
while( MS_LSW()!=0 || MS_RSW()!=0 );
return;
}
return;
}
/**********************************************************
枠新規
**********************************************************/
void Rec_new_fream(sx,sy)
int sx,sy;
{
int i,m,n,x,y,xo,yo,bi;
int xx,yy,b;
int x1o,y1o;
int px1,py1,px2,py2;
int _RecX1,_RecY1;
int _RecX2,_RecY2;
//--- 記憶
_RecX1 = RecX1;
_RecY1 = RecY1;
_RecX2 = RecX2;
_RecY2 = RecY2;
x1o=y1o=-1;
xo=-1;
yo=-1;
//--- はじめの位置を記憶
if ( RecVwBai>=0 ){
bi=1<<RecVwBai;
px1=((sx-16+RecPX*bi))/bi;
py1=((sy-16+RecPY*bi))/bi;
} else {
bi=1<<(-RecVwBai);
px1=((sx-16+RecPX/bi))*bi;
py1=((sy-16+RecPY/bi))*bi;
}
px2=px1+1;
py2=py1+1;
if ( px1<0 || py1<0 || px1>=ScanDataX || py1>=ScanDataY )
return;
Rec_PosSetDraw(px1,py1,px2,py2);
while( MS_LSW()!=0 && (b=MS_RSW())==0 ){
_dos_keysns();
_dos_change_pr();
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( xo==xx && yo==yy )
continue;
xo=xx;
yo=yy;
if ( RecVwBai>=0 ){
x=((xx-16+RecPX*bi))/bi;
y=((yy-16+RecPY*bi))/bi;
} else {
x=((xx-16+RecPX/bi))*bi;
y=((yy-16+RecPY/bi))*bi;
}
m=px1;
n=py1;
if ( x>m ){
m=x;
x=px1;
}
if ( y>n ){
n=y;
y=py1;
}
if ( x<0 )
x=0;
if ( m>ScanDataX-1 )
m=ScanDataX-1;
if ( y<0 )
y=0;
if ( n>ScanDataY-1 )
n=ScanDataY-1;
Rec_PosSetDraw(x,y,m,n);
}
if ( b!=0 || (RecX2==RecX1+1 && RecY2==RecY1+1) ){
//右クリック キャンセル
Rec_PosSetDraw(_RecX1,_RecY1,_RecX2,_RecY2);
MsPat(-1);
while( MS_LSW()!=0 || MS_RSW()!=0 );
return;
}
return;
}
/**************************************************
files表示
**************************************************/
void ViewFiles(y)
int y;
{
int i,l,n;
UNchar buf[256];
struct _fillptr PP;
if ( y<0 ){
buf[0]='A'-1+Drive;
buf[1]=':';
buf[2]=0;
p_12W(22*16-6+2,13*16+2,buf);
if ( jstrlen(Apath)<128/6 ){
p_12_sprintf(23*16+2,13*16+2,"%-21s",&Apath[3]);
} else {
l=jstrlen(Apath);
n=0;
for(i=0;i<l;i++){
if ( ZenChk(Apath[i]) ){
i++;
continue;
}
if ( Apath[i]=='\\' ){
buf[n++]=i;
}
}
if ( n>=2 )
p_12_sprintf(23*16+2,13*16+2,".%-19s",&Apath[buf[n-2]]);
else p_12_sprintf(23*16+2,13*16+2,".%-19s",&Apath[buf[n-1]]);
}
p_12_sprintf(19*16+2,11*16+2,"%-28s",Afile);
return;
}
if ( DDS_max<0 ){
PP.x1=19*16+1;
PP.y1=14*16+1;
PP.x2=30*16-1-1;
PP.y2=30*16-1-1;
PP.color=PalTable[15];
_iocs_fill( &PP);
p_12W(20*16,22*16,"NO DISK");
return;
}
for(l=0;l<16;l++){
n=l+y;
if ( n>=DDS_max ) /*バッファの数 -1なら、未挿入 */
break;
if ( DDS[n].atr&bit(4) ){
// ディレクトリ
if ( DDS[n].fext[0]!=0 ){
sprintf(buf,"%-18s.%-3s <DIR>",
DDS[n].fname,
DDS[n].fext
);
} else {
sprintf(buf,"%-18s <DIR>",
DDS[n].fname
);
}
} else {
i=DDS[n].date;
if ( DDS[n].fext[0]!=0 ){
sprintf(buf,"%-18s.%-3s %2d/%02d",
DDS[n].fname,
DDS[n].fext,
//(80+(i>>25))%100,
(i>>21)&0xF,(i>>16)&0x1F
);
} else {
sprintf(buf,"%-18s %2d/%02d",
DDS[n].fname,
//(80+(i>>25))%100,
(i>>21)&0xF,(i>>16)&0x1F
);
}
}
p_12W(19*16+1,14*16+2+l*16,buf);
}
if ( l<16 ){
PP.x1=19*16+1;
PP.x2=30*16-1-1;
PP.y1=14*16+l*16+1;
PP.y2=30*16-1-1;
PP.color=PalTable[15];
_iocs_fill( &PP);
}
return;
}
/********************************************************
ファイルモード表示
********************************************************/
void Rec_SaveModeDraw()
{
int i,j,ssp;
ssp=_iocs_b_super(0);
for(i=0;i<=5;i++){
j=19+i*2;
if ( i==RecSavMode ){
GGSP16_ON_S(TADDS(j,9),MAP[j+(9)*32],MAP[j+1+(9)*32]);
} else {
GGSP16_OF_S(TADDS(j,9),MAP[j+(9)*32],MAP[j+1+(9)*32]);
}
}
if ( ssp>=0 )
_iocs_b_super(ssp);
return;
}
/********************************************************
ファイルソートモード表示
********************************************************/
void Rec_SortModeDraw()
{
int i,j,m,n,ssp;
p_12W(22*16+4,30*16+2,FileStStr[FilerSortMode]);
}